<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript" charset="utf-8">
	//加载联系人
	function getContacts() {
		$.ajax({
			type : "POST",
			url : "${pageContext.request.contextPath}/friendAction!getFriendGroup.action",
			dataType : "json",
			error : function(info) {
				eval(info.responseText);
			},
			success : function(obj) {
				if (obj && obj.length > 0) {
					for ( var x = 0; x < obj.length; x++) {
						var o = obj[x];
						//全部加到groups中
						groups.push(o);
						$('#talk-contacts-frame').accordion('add', {
							title : o.groupname,
							href : '${pageContext.request.contextPath}/app/user/talk/friend-tree.jsp?groupid=' + o.id,
							selected : true
						//初始化的时候 每个菜单 都加载一遍
						});
					}
					$('#talk-contacts-frame').accordion('select', obj.length - 1); //把最后一个菜单关闭
				}
			}
		});
	}

	$(function() {
		//如果有id说明已经登陆过了
		if ('null' != '${userSession.id}' && '' != $.trim('${userSession.id}')) {
			getContacts(); //加载联系人
		}
	});
</script>
<div id="talk-contacts-frame" class="easyui-accordion" data-options="fit:true,border:false"></div>